package com.fuhaiwei.domain.interceptor.impl;

import org.aopalliance.intercept.MethodInvocation;

import com.fuhaiwei.basic.spring.BeanFactory;
import com.fuhaiwei.basic.utils.Logger;
import com.fuhaiwei.domain.interceptor.AbstractLogInterceptor;

public class LogInterceptorImpl extends AbstractLogInterceptor {

	public Object invoke(MethodInvocation invocation) throws Throwable {
		Logger logger = (Logger) BeanFactory.getBean("logger");
		logger.enter(getMethodString(invocation));
		Object result = invocation.proceed();
		if (result == null) {
			logger.back("return : null");
		} else {
			logger.back("return : " + result);
		}
		return result;
	}

}
